package router

import (
	"github.com/gin-gonic/gin"
	swaggerFiles "github.com/swaggo/files"
	ginSwagger "github.com/swaggo/gin-swagger"
	"server/controller/admin"
	"server/controller/auth"
	"server/controller/product"
	"server/controller/user"
	"server/middle_ware"
)

//总路由
func RouterAll(engine *gin.Engine) {
	engine.Use(middle_ware.Cors)
	//用户模块
	user.RouterUser(engine.Group("/user"))

	//管理员模块
	admin.RouterAdmin(engine.Group("/admin"))

	//商品模块
	product.ProductRouter(engine.Group("/product"))

	//auth 模块
	auth.AuthRouter(engine)

	//swagger
	engine.GET("/swagger/*any",ginSwagger.WrapHandler(swaggerFiles.Handler))
}
